package org.prothliberger.courseCode;
import java.util.ArrayList;
import java.util.Collections;
 

public class example_code {

	
		 
		  public static void main_1(){
		    //create a ArrayList object
		    ArrayList arrayList = new ArrayList();
		   
		    //Add elements to ArrayList
		    arrayList.add("A");
		    arrayList.add("B");
		    arrayList.add("D");
		 
		    /*
		      To replace all elements of Java ArrayList with specified element use,
		      static void fill(List list, Object element) method of Collections class.
		    */
		   
		    System.out.println("Before replacement, ArrayList contains : " + arrayList);
		   
		    Collections.fill(arrayList,"REPLACED");
		   
		    System.out.println("After replacement, ArrayList contains : " + arrayList);
		 
		  }
		}
	

